﻿using System.Web.Mvc;
using Web.Models.ViewModels;

namespace Web.Areas.ManagerArea.Controllers
{
    public class BaseController : Controller
    {
        protected void AddErrors(out DbResult result)
        {
            result = new DbResult {Message = ""};
            foreach (var key in ModelState.Keys)
            {
                foreach (var error in ModelState[key].Errors)
                {
                    result.Message += $"{error.ErrorMessage}<br>";
                }
            }
        }
    }
}